﻿<div ms-controller="LIST">
    <div class="btn-add">
    </div>
    <div class="tab-filter-type" style="padding-left: 30px">
        <div class="oh">
            <h5 class="pull-left tr" style="width: 60px">类型：</h5>
            <ul class="tab-type ft14" style="margin-left: 50px">
                <li ms-click="SelectDataType('')"><span class="active">全部</span></li>
                <li ms-click="SelectDataType('1')"><span>待审核</span></li>
                <li ms-click="SelectDataType('2')"><span>已审核</span></li>
                <li ms-click="SelectDataType('3')"><span>已上报</span></li>
                <li ms-click="SelectDataType('4')"><span>已中止</span></li>
                <li ms-click="SelectDataType('5')"><span>已收款</span></li>
                <li ms-click="SelectDataType('-1')"><span>被拒绝</span></li>

            </ul>
        </div>
        <div class="oh">
            <div class="row">
                <div class="col-md-3">
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon" style="background-color: transparent; color: black;">所属单位</div>
                            <input type="text" class="form-control" id="condw" placeholder="">
                            <div class="input-group-addon" ms-click="seldw()">选择</div>
                        </div>
                    </div>
                </div>
                <div class=" col-md-3">
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon" style="background-color: transparent; color: black;">计划科目</div>
                            <input type="text" class="form-control" id="conkm" placeholder="">
                            <div class="input-group-addon" ms-click="seljhsx()">选择</div>
                        </div>
                    </div>
                </div>
                <div class=" col-md-3">
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon" style="background-color: transparent; color: black;">产品类型</div>
                            <select ms-duplex="querymodel.cplx" class="form-control">
                                <option value="">请选择</option>
                                <option ms-repeat-item="cplx" ms-attr-value="item.ID">{{item.TypeName}}</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class=" col-md-3">
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon" style="background-color: transparent; color: black;">回款类型</div>
                            <select ms-duplex="querymodel.hklx" class="form-control">
                                <option value="">请选择</option>
                                <option ms-repeat-item="hklx" ms-attr-value="item.ID">{{item.TypeName}}</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="oh">
            <div class="row">
                <div class="col-xs-6 col-md-3" style="display: none">
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon" style="background-color: transparent; color: black;">付款起止时间</div>
                            <input type="text" class="form-control" id="FKSDATE" placeholder="开始时间" style="width: 45%">
                            <input type="text" class="form-control" id="FKEDATE" placeholder="结束时间" style="width: 45%">
                        </div>
                    </div>
                </div>
                <div class="col-xs-6 col-md-3">
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon" style="background-color: transparent; color: black;">执行金额</div>
                            <input type="text" class="form-control" id="SJE" placeholder="金额" style="width: 45%" ms-duplex="querymodel.zxje1">

                            <input type="text" class="form-control" id="EJE" placeholder="金额" style="width: 45%" ms-duplex="querymodel.zxje2">
                        </div>
                    </div>
                </div>
                <div class="col-xs-6 col-md-3">
                    <button type="button" class="btn btn-success" style="margin-right: 20px" ms-click="querydata()"><i class=" iconfont icon-rctx ft12 mr5"></i>点击查询</button>
                </div>
                <div class="col-xs-6 col-md-3 tr">
                </div>
            </div>
        </div>
    </div>

    <div class="default-tab ft14 pt20 grid" style="margin-top: 10px">

        <div id="jqxgrid" class="jqxgrid" style="border-right: 0; border-left: 0;"></div>

    </div>
</div>
<link rel="stylesheet" href="/ViewV5/JS/YanGrid/jqwidgets/styles/jqx.base.css" />
<link rel="stylesheet" href="/ViewV5/JS/YanGrid/jqwidgets/styles/jqx.office.css" />
<script src="/VIEWV5/JS/YanGrid/jqwidgets/jqgridall.js"></script>
<script>
    var goption = {
        columns: [
                //{
                //    text: '#', sortable: false, filterable: false, editable: false,
                //    groupable: false, draggable: false, resizable: false,
                //    datafield: '', width: 50, cellsalign: 'center', align: 'center',
                //    cellsrenderer: function (row, column, value) {
                //        var data = $('#jqxgrid').jqxGrid('getrowdata', row);
                //        return '<div class="icheckbox_square-blue" style="margin: 15px;" dataid="' + data.ID + '"  datarow="' + row + '"><span class="iconfont icon-check ft12"></span></div>';
                //    }
                //},
              { text: 'ID', dataField: 'ID', hidden: "hides" },
              { text: '备注1', dataField: 'statusremark', hidden: "hides" },
              { text: '单位名称', dataField: 'dwname' },
              { text: '项目期别', dataField: 'Remark1' },
              { text: '计划科目', dataField: 'FLName' },
              { text: '产品类型', dataField: 'cplxname' },
              { text: '回款类型', dataField: 'hklxname' },
              { text: '金额小计', dataField: 'jexj', cellsformat: 'c2' },
              { text: '第一月', dataField: 'je1', cellsformat: 'c2' },
              { text: '第二月', dataField: 'je2' },
              { text: '第三月', dataField: 'je3' },
              { text: '第一月描述', dataField: 'je1dec' },
              { text: '第二月描述', dataField: 'je2dec' },
              { text: '第三月描述', dataField: 'je3dec' },
              { text: '备注', dataField: 'remark' },
              { text: '第一周', dataField: 'week1' },
              { text: '第二周', dataField: 'week2' },
              { text: '第三周', dataField: 'week3' },
              { text: '第四周', dataField: 'week4' },
          
                                          { text: '执行金额', dataField: 'zxje', editable: false },
            {
                text: '计划状态', dataField: 'status', cellsrenderer: function (row, column, value) {
                    var data = $('#jqxgrid').jqxGrid('getrowdata', row);
                    var desc = ComFunJS.jhsrstatus(data.status, data);

                    var html = "";
                    html = '<a href="#" onclick="tempindex.shxq(\'' + row + '\')"><p class="text-error" style="display: inline;font-size: 16px;    color: blue;">' + desc + '</p></a>';
                    var returns = ' <div style="overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 12px;">' + html + '</div>';
                    return returns;
                }
            }
             //{
             //    text: '操作', dataField: 'CRUser', sortable: false, filterable: false, editable: false,
             //    groupable: false, draggable: false, resizable: false, width: 100, cellsrenderer: function (row, column, value) {
             //        var data = $('#jqxgrid').jqxGrid('getrowdata', row);
             //        var html = "";
             //        html = '<a href="#" onclick="tempindex.jhzxmx(\'' + data.ID + '\')"><p class="text-error" style="display: inline;font-size: 16px;    color: blue;">执行明细</p></a>';

             //        var returns = ' <div style="overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 12px;">' + html + '</div>';
             //        return returns;
             //    }
             //},
        ]
    };

    var tempindex = avalon.define({
        $id: "LIST",
        tmpListData: [],
        querymodel: { dwid: "", jhkm: "", cplx: "", hklx: "", zxje1: "", zxje2: ""},
        JHDATA: {},
        selids: "",
        datatype: "",
        cplx: [],
        hklx: [],
        SelectDataType: function (type) {
            tempindex.datatype = type;
            tempindex.GetLIST();

        },
        shxq: function (row) {
            var data = $('#jqxgrid').jqxGrid('getrowdata', row);

            ComFunJS.winviewform("/ViewV5/AppPage/APP_ADD_WF.html?FormCode=JHSR_JHSR&JHID=" + tempindex.JHDATA.ID + "&ID=" + data.ID + "&PIID=" + data.intProcessStanceid + "&r=" + Math.random(), "查看", "1000");
        },
        seldw: function () {
            top.ComFunJS.winbtnwin("/ViewV5/AppPage/XTGL/BranchSelect.html?isqx=Y&issignle=N", "选择单位", 500, 470, {}, function (layero, index) {
                var frameid = $("iframe", $(layero)).attr('id');
                var branch = ComFunJS.isIE() ? top.window.frames[frameid].getselectedbranch() : top.window.frames[frameid].contentWindow.getselectedbranch();
                tempindex.querymodel.dwid = branch.branchid;
                $("#condw").val(branch.branchname)
                top.layer.close(index)
            })
        },
        seljhsx: function () {

            top.ComFunJS.winbtnwin("/ViewV5/AppPage/JHZD/JHSXSelect.html?iszf=N", "选择计划科目", 500, 470, {}, function (layero, index) {
                var frameid = $("iframe", $(layero)).attr('id');
                var datainfo = ComFunJS.isIE() ? top.window.frames[frameid].getselecteddata() : top.window.frames[frameid].contentWindow.getselecteddata();
                tempmodel.modelData.jhsxid = datainfo.dataid;
                $("#jhsxname").val(datainfo.dataname)
                top.layer.close(index)
            })
        },
        querydata: function () {
            tempindex.GetLIST();
        },
        InitWigetData: function () {
            $.getJSON('/API/VIEWAPI.ashx?Action=JHGL_GETCKINITDATA', {}, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    tempindex.hklx = resultData.Result2;
                    tempindex.cplx = resultData.Result3;
                }
            })
            tempindex.JHDATA = model.JHDATA;
            //显示的列名
            tempindex.GetLIST();
            $(".tab-box li").each(function (i) {
                $(this).click(function () {
                    $(this).addClass("active").siblings().removeClass("active");
                    $("#wrap>div:eq(" + i + ")").show().siblings().hide();
                });
            });

        },
        getcheckid: function () {
            $("#jqxgrid").find(".icheckbox_square-blue").each(function () {
                if ($(this).hasClass("checked")) {
                    tempindex.selids = tempindex.selids + $(this).attr("dataid") + ",";
                }
            })
        },
        jhzxmx: function (dataid) {
            ComFunJS.winviewform("/ViewV5/AppPage/JHZX/ZXMX.html?JHID=" + tempindex.JHDATA.ID + "&MXID=" + dataid + "&r=" + Math.random(), "计划执行");

        },
        GetLIST: function () {
            try {
                $('#jqxgrid').jqxGrid('destroy');

            } catch (e) {

            }
            $(".grid").append('<div id="jqxgrid" class="jqxgrid" style="border-right:0;border-left:0;"></div>')
            $.getJSON('/API/VIEWAPI.ashx?Action=JHGL_GETJHSRMXLIST', { P1: tempindex.JHDATA.ID, P2: tempindex.datatype, dw: tempindex.querymodel.dwid, jhkm: tempindex.querymodel.jhkm, cplx: tempindex.querymodel.cplx, hklx: tempindex.querymodel.hklx, zxje1: tempindex.querymodel.zxje1, zxje2: tempindex.querymodel.zxje2 }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    ComFunJS.inithighgrid(goption, resultData.Result, "jqxgrid");
                    tempindex.tmpListData = resultData.Result;
                }
            })
        }
    }) //@ sourceURL=JHCK_SRLIST.js;
</script>
